#include "camprec.h"

#include "CAM3DLine.h"

namespace cm
{
CCAM3DLine::CCAM3DLine(void):m_bDirty(true)
{
}

CCAM3DLine::CCAM3DLine (const CCAM3DPoint &p_1, const CCAM3DPoint &p_2):m_bDirty(true)
{
	p1 = p_1; 
	p2 = p_2;
}

CCAM3DLine::CCAM3DLine (const double &x1, const double &y1, const double &z1, const double &x2, const double &y2, const double &z2):m_bDirty(true)
{
	p1.x = x1; p1.y = y1; p1.z = z1;
	p2.x = x2; p2.y = y2; p2.z = z2;
}

CCAM3DLine::~CCAM3DLine(void){}

void CCAM3DLine::set (const CCAM3DPoint &p_1, const CCAM3DPoint &p_2)
{
	m_bDirty = true;
	p1 = p_1; p2 = p_2;
}

void CCAM3DLine::set (const double &x1, const double &y1, const double &z1, const double &x2, const double &y2, const double &z2)
{
	m_bDirty = true;
	p1.x = x1; p1.y = y1; p1.z = z1;
	p2.x = x2; p2.y = y2; p2.z = z2;
}


double CCAM3DLine::lenght ()
{
	static double l = 0;
	//if (m_bDirty)
	{
		double dx = p2.x-p1.x;
		double dy = p2.y-p1.y;
		double dz = p2.z-p1.z;
		l = sqrt (dx*dx+dy*dy+dz*dz);
	}
	return l;
}


};
